//******************************************************************
//  Box.java   Author:Tang Caiming
//
//  关于盒子信息的类.
//******************************************************************

public class Box
{
   private double width;  // 盒子宽度
   private double height;  // 盒子高度
   private double thickness; // 盒子厚度
   private boolean full; // 盒子是否装满
   private double v; // 放入盒子物品体积

   // 构造方法
   public Box(){}
   public Box(double width, double height, double thickness, double v)
   {
      this.width = width;
      this.height = height;
      this.thickness = thickness;
      this.v = v;
      full = false;
   }
  
   // 定义设置获取盒子高度、宽度、厚度方法
   public void setWidth(double width)
   {
      this.width = width;
   }

   public double getWidth()
   {
      return this.width;
   }
  
   public void setHeight(double height)
   {
      this.height = height;
   }

   public double getHeight()
   {
      return this.height;
   }

   public void setThickness(double thickness)
   {
     this.thickness = thickness;
   }

   public double getThickness()
   {
      return this.thickness;
   }

   public void setFull(boolean full)
   {
      this.full = full;
   }

   public boolean getFull()
   {
      return this.full;
   }
   
   public void setV(double v)
   {
      this.v = v;
   }
   
   public double getV()
   {
      return this.v;
   }

   // 定义方法，输出字符串
   public String toString()
   {
      return "盒子宽度: " + width + "\n" +
             "盒子高度: " + height + "\n" +
             "盒子厚度：" + thickness + "\n" +
             "放入盒子物品体积: " + v + "\n" +
             "盒子是否装满. ";

   }

   public boolean isFull()
   {
      if (v > (width * height * thickness))
         full = false;
      else
         full = true;
      return full;
   }
}
